Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(action): allow main ref when krew release bot action is triggered #80

Merged
merged 4 commits into from
Nov 10, 2024

Conversation

rajatjindal
Copy link
Owner

@rajatjindal rajatjindal commented Nov 10, 2024

fixes #79

@rajatjindal rajatjindal merged commit 3d9faef into main Nov 10, 2024
1 check passed
@RainbowMango
Copy link

I understand this PR enables krew-release-bot to skip pre-releases, am I right?
Is there a plan to check if it's the latest release? @rajatjindal

For reference, currently, we are skipping the latest tag in the workflows, but glad to see the krew-release-bot can do it by default.
https://github.com/karmada-io/karmada/blob/9f4d39218aacdc9756cada19f97cb417a56daebf/.github/workflows/release.yml#L204-L223

    steps:
    - name: get latest tag
      id: get-latest-tag
      run: |
        export LATEST_TAG=`gh api repos/karmada-io/karmada/releases/latest | jq -r '.tag_name'`
        echo "Got the latest tag:$LATEST_TAG"
        echo "event.tag:"${{ github.event.release.tag_name }}
        echo "latestTag=$LATEST_TAG" >> "$GITHUB_OUTPUT"
    - uses: actions/checkout@v4
      if: steps.get-latest-tag.outputs.latestTag == github.event.release.tag_name
    - name: Update new version in krew-index
      if: steps.get-latest-tag.outputs.latestTag == github.event.release.tag_name
      uses: rajatjindal/[email protected]

@rajatjindal
Copy link
Owner Author

Hi @RainbowMango

My understanding is that the krew-release-bot used to skip the pre-releases always (see this from before this PR)

What I've fixed is that I moved the pre-release check to cicd.Provider interface. Earlier that check was outside cicd provider interface, so it would have failed if someone tried to run it from other providers workflow.

As part of this PR what I've also changed is to check if the release was triggered as part of push to main branch and no explicit tag is provided, then the bot check if the current commit for which this was triggered has a release associated with it, then it uses the tag from that release.

I hope that makes sense, pls feel free to reach out if you see any issues/concerns with that.

@RainbowMango
Copy link

Thanks for the clarification. It makes sense to me.

What I'm asking is if there is a plan to skip the non-latest release.
As you know, Krew only accepts the update from the latest release(or straightforward version bump). Otherwise, once we cut a new release, krew-release-bot would send a PR but it won't be accepted. Like this one.

PS:
It's not a problem for us now as we checked the release before involving krew-release-bot, only the latest release would send an update PR.
This is probably a common issue for other projects, so I guess it might be enhanced from the action side.

@rajatjindal
Copy link
Owner Author

ah, it took me a second to realize what you mean by latest release here. skipping if it is not latest makes sense to me. could you please open an issue for it, I will think a bit more about it and update on that issue accordingly.

thanks for using the bot.

@RainbowMango
Copy link

You can refer to this issue: #75

@rajatjindal
Copy link
Owner Author

You can refer to this issue: #75

one easy fix could be to trigger the github action only if it matches a specific regex. it will be a manual process, but is a straight forward workaround. (in either case i will think a bit about it)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Krew GITHUB_REF failure
2 participants